<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>子页面</title>
</head>
<body>
<h2>弹出的子窗口</h2>
<button id="popBtn">向父窗口传递信息</button>
</body>
<script>

    var popBtn = document.getElementById('popBtn');
    popBtn.onclick = function (e) {
        // 将消息发送给指定来源的父窗口，未指定则发送给所有窗口
        window.opener.postMessage('我是子窗口window.opener.postMessage传递过来的信息'); // 参数message,targetOrigin
    }

</script>
</html>